package cn.thoughtworks.school.entities;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.hankcs.hanlp.HanLP;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Objects;

@Entity
@Table(name = "surveyQuizChoices")
@Getter
@Setter
@NoArgsConstructor
public class SurveyQuizChoices {
    @EmbeddedId
    private SurveyQuizChoicesComplexPK complexPK;
    private String choice;

    public SurveyQuizChoices(SurveyQuizChoicesComplexPK surveyQuizChoicesComplexPK, String choice) {
        this.complexPK = surveyQuizChoicesComplexPK;
        this.choice = choice;
    }

    @JsonProperty("choice_zh_TW")
    public String getChoiceTW() {
        return Objects.isNull(choice) ? "" : HanLP.s2tw(choice);
    }


}
